< previous page page_196 next page >

Page 196
registry file. Conversely, you can retrieve these settings from the registry by using the GetSetting command. The syntax is basically the same for both, as you can see here:
SaveSetting appname, section, key, setting
GetSetting(appname, section, key[, default])
The following are the parameters for each of the commands:
appnameString containing the name of the application or project whose key setting is requested.
sectionString containing the section name where the key setting is found.
keyString containing the name of the key setting to return.
settingExpression containing the value to which the key is being set.
defaultThe value to return if no value is set in the key setting.
When the user changes any of the colors or fonts, you should save them in the registry. When the application is started, these settings should be retrieved during the form_initialize routine to set the objects. To understand how this actually works, go back and open the dlgFileOpenCopy project from Day 2, The Windows Common Dialog in Use. When you execute the application and then change the colors on the form, the changes are not saved anywhere. So, when you close the application and restart it, the colors are reset to the defaults. You can use the SaveSetting and GetSetting functions to save the color change and then retrieve it when the application is started. In the cmdColor_Click routine, place the following line of code after the call to the common dialog function:
SaveSetting FileCopy, Colors, frmBackColor, frmDialog.BackColor
Then, in the form's LOAD routine, add the following line of code:
frmDialog.BackColor = GetSetting(FileCopy, Colors, frmBackColor,_
    vb3DFace)
This line of code will get the color value and set the application's background color using it. Now when you run the application and change the color, it will be saved for future use. These two lines of code must be used for every color value or font-related value that you let the user change. In addition, you might want to set the original colors as constants in the application. By doing this, you can enable the user to reset the colors or fonts to the default settings.
The SSTab Control
The SSTab control allows you to add a group of tabs to a form, with each one acting as a container for other controls. Only one tab will be active in the control at a time, displaying the controls it contains to the user while hiding the controls that are on the other tabs.

 
< previous page page_196 next page >

If you like this book, buy it!